﻿@model GitCandy.Models.RepositoryModel
@using GitCandy.Web.App_GlobalResources
@using NewLife.Model;
@using GitCandy.Web.Extensions;
@{
    ViewBag.Title = String.Format(SR.Shared_TitleFormat, String.Format(SR.Repository_DetailTitle, Model.Name));
    var token = ViewBag.Token as IManageUser;
}

<h3>@String.Format(SR.Repository_DetailTitle, Model.Name)</h3>

@if (Model != null)
{
    <dl class="dl-horizontal">

        <dt>@Html.DisplayNameFor(s => s.Name)</dt>
        <dd>@Model.Name</dd>

        <dt>@Html.DisplayNameFor(s => s.IsPrivate)</dt>
        <dd>@Html.DisplayFor(s => s.IsPrivate)</dd>

        <dt>@Html.DisplayNameFor(s => s.AllowAnonymousRead)</dt>
        <dd>@Html.DisplayFor(s => s.AllowAnonymousRead)</dd>

        <dt>@Html.DisplayNameFor(s => s.AllowAnonymousWrite)</dt>
        <dd>@Html.DisplayFor(s => s.AllowAnonymousWrite)</dd>

        <dt>@Html.DisplayNameFor(s => s.DefaultBranch)</dt>
        <dd>@Model.DefaultBranch</dd>

        <dt>@Html.DisplayNameFor(s => s.Description)</dt>
        <dd>@Model.Description</dd>

        <dt>@Html.DisplayNameFor(s => s.Collaborators)</dt>
        <dd>@Html.DisplayFor(s => s.Collaborators)</dd>

        <dt>@Html.DisplayNameFor(s => s.Teams)</dt>
        <dd>@Html.DisplayFor(s => s.Teams)</dd>

        <dt>@Html.DisplayNameFor(s => s.Views)</dt>
        <dd>@Html.DisplayFor(s => s.Views)</dd>

        <dt>@Html.DisplayNameFor(s => s.Downloads)</dt>
        <dd>@Html.DisplayFor(s => s.Downloads)</dd>

        <dt>
            @*@Html.ActionLink(SR.Repository_Tree, "Tree", new { Model.Owner, Model.Name }, new { @class = "btn btn-default pull-left" })*@
            @Html.RouteLink(SR.Repository_Tree, "UserGitWeb", new { Model.Owner, Model.Name }, new { @class = "btn btn-default pull-left" })
        </dt>
        <dd>
            @if (token != null && (Model.CurrentUserIsOwner || token.IsAdmin()))
            {
                @Html.ActionLink(SR.Shared_Edit, "Edit", new { Model.Id }, new { @class = "btn btn-primary" })
                @:
                @Html.ActionLink(SR.Repository_Relationship, "Coop", new { Model.Id }, new { @class = "btn btn-info" })
            }
        </dd>
    </dl>
}
